package com.wealth.scsj.p_app.presenter;

import android.util.Log;

import com.orhanobut.logger.Logger;
import com.wealth.scsj.p_app.base.SelectUserHasBindBankCardBase;
import com.wealth.scsj.p_app.bean.SelectUserHasBindBankCardBean;
import com.wealth.scsj.p_app.model.SelectUserHasBindBankCardModel;


import dkmvp.mvp.BasePresenter;
import dkmvp.net.ResponseCallback;
import okhttp3.RequestBody;

/**
 * 修改登录密码presenter
 */

public class SelectUserHasBindBankCardPresenter extends BasePresenter implements SelectUserHasBindBankCardBase.IPresenter {

    private SelectUserHasBindBankCardBase.IModel mModel;
    private SelectUserHasBindBankCardBase.IView mView;

    public SelectUserHasBindBankCardPresenter(SelectUserHasBindBankCardBase.IView view) {
        mView = view;
        mModel = new SelectUserHasBindBankCardModel();
    }


    @Override
    public void deliverData(RequestBody requestBody) {
        addSubscription(mModel.getData(requestBody, new ResponseCallback<SelectUserHasBindBankCardBean>() {
            @Override
            public void onSuccess(SelectUserHasBindBankCardBean result) {
                if (result.getStatusCode() == 200) {
                    mView.showSuccessMsg("支付密码修改成功", result);
                    Logger.d("支付密码修改成功" + result.toString());
                } else {
                    mView.showErrorMsg(result.getMsg());
                }
            }

            @Override
            public void onFaild(String msg) {
                mView.showErrorMsg(msg);
                Log.e("获取银行卡列表", msg + "");
            }
        }));
    }

}
